<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePersonalLanguageTable extends Migration{
    /**
     * 作者 柯良志
     * 个人用户  数据表
     * 添加时间 2016-7-28
     */
    public function up(){
        /** 语言能力表 resume_language_skill   **/
        Schema::create('resume_language_skill', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->integer('uid')->unsigned()->index('uid')->default(0)->comment('所属用户id');
            $table->tinyInteger('language')->unsigned()->default(0)->comment('语种');
            $table->tinyInteger('degree')->unsigned()->default(0)->comment('熟练程度	简单沟通|读写精通|商务洽谈|同声翻译');
            $table->tinyInteger('level')->unsigned()->default(0)->comment('语言等级');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 技能专长表 resume_skill   **/
        Schema::create('resume_skill', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->integer('uid')->unsigned()->index('uid')->default(0)->comment('所属用户id');
            $table->string('skillname', 60)->default('')->comment('技能名称');
            $table->tinyInteger('degree')->unsigned()->default(0)->comment('熟练程度	入门|熟练|精通');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 证书表 resume_certificate   **/
        Schema::create('resume_certificate', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->integer('uid')->unsigned()->index('uid')->default(0)->comment('所属用户id');
            $table->string('certificate_name', 100)->default('')->comment('证书名称');
            $table->timestamp('gettime')->nullable()->comment('获得时间');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 我的作品表 resume_works   **/
        Schema::create('resume_works', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->integer('uid')->unsigned()->index('uid')->default(0)->comment('所属用户id');
            $table->string('works_name', 60)->default('')->comment('作品名称');
            $table->text('description')->default('')->comment('作品描述');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 我的作品图片 resume_works_img   **/
        Schema::create('resume_works_img', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->integer('uid')->unsigned()->index('uid')->default(0)->comment('所属用户id');
            $table->integer('works_id')->unsigned()->index('works_id')->default(0)->comment('所属作品id');
            $table->string('imgurl', 255)->default('')->comment('图片地址');
            $table->string('originalimg', 255)->default('')->comment('原文件名');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 其它信息 resume_other   **/
        Schema::create('resume_other', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->integer('uid')->unsigned()->index('uid')->default(0)->comment('所属用户id');
            $table->string('title', 100)->default('')->comment('主题');
            $table->text('content')->default('')->comment('内容');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });
    }

    /**
     * 作者 柯良志
     * 个人用户数据表  Reverse the migrations.
     * 添加时间 2016-7-28
     */
    public function down(){
        Schema::dropIfExists('resume_Language_skill');
        Schema::dropIfExists('resume_skill');
        Schema::dropIfExists('resume_certificate');
        Schema::dropIfExists('resume_works');
        Schema::dropIfExists('resume_works_img');
        Schema::dropIfExists('resume_other');
    }
}
